package com.gk.ldj.test;

import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import com.gk.ldj.base.Configure;
import com.gk.ldj.base.Json;
import com.gk.ldj.base.Result;

public class Main
{
	public static void main(String[] args)
	{
		String path = "d:/data.xml";
		try
		{
			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
			factory.setValidating(false);
			DocumentBuilder builder = factory.newDocumentBuilder();
			Document document = builder.parse(new File(path));
			document.getDocumentElement().normalize();
			Node node = document.getFirstChild();
			NodeList list = node.getChildNodes();
			for (int i = 0; i < list.getLength(); i++)
			{
				Node a = list.item(i);
				if (a.getNodeName().equals("dbs"))
				{
					parseDb(a);
				}
				else if (a.getNodeName().equals("methods"))
				{
					parseMethod(a);
				}
				
			}
		}
		catch (Exception exp)
		{
			exp.printStackTrace();
			
		}
	}
	
	private static void parseDb(Node n)
	{
		NodeList list = n.getChildNodes();
		for (int i = 0; i < list.getLength(); i++)
		{
			Node a = list.item(i);
			System.out.println(a.getNodeName());
			
		}
	}
	
	private static void parseMethod(Node n)
	{
		
	}
}
